<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0 ,user-scalable=no">
    <title>Document</title>
    <link rel="stylesheet" href="./css/index.css">
    <!-- 引入 layui.css -->
    <!-- <link rel="stylesheet" href="http://unpkg.com/layui@2.6.8/dist/css/layui.css"> -->

    <!-- 引入 layui.js -->
    <!-- <script src="http://unpkg.com/layui@2.6.8/dist/layui.js"> </script> -->
</head>

<body>
    <div class="bigbox">
        <div class="box">
            <div class="top">
                <img src="./logo2.png" alt="">
            </div>
            <div class="mian">
                <form action="">
                    <input type="text" id="userName" placeholder="姓名：">
                    <input type="text" id="phone" placeholder="+86：">
                    <input type="text" id="card" placeholder="身份证号码：">
                </form>
            </div>
            <div class="footer">
                <button id="btn1" class="layui-btn layui-btn-radius layui-btn-normal">我的预约</button>
                <button id="btn2" class="layui-btn layui-btn-radius layui-btn-normal">开始预约</button>
            </div>
        </div>
    </div>
</body>

<script src="./index.js"></script>
<script>
    let userName = document.querySelector("#userName");
    let phone = document.querySelector("#phone");
    let card = document.querySelector("#card");
    let btn1 = document.querySelector("#btn1");
    let btn2 = document.querySelector("#btn2");

    btn1.addEventListener("click", function () {
        sessionStorage.setItem("name", String(userName.value));
        sessionStorage.setItem("phone", String(phone.value));
        // if (sessionStorage.getItem("token")) {
            window.open("./wo.html", '_self')
        // }
    })
    //开始预约  
    btn2.addEventListener("click", () => {
        sessionStorage.setItem("name", String(userName.value));
        sessionStorage.setItem("phone", String(phone.value));
        sessionStorage.setItem("card", String(card.value));
        // 跳转到预约页面
        console.log(aFn().then(e => { console.log(e) }));
        //  af2();
        if ([...phone.value].length == 11 && [...card.value].length == 18) {

            window.open("./yuyue.html", '_self')//
        } else {
            layer.alert('信息输入有误');
        }
    });

    async function aFn() {
        let t1 = await af1()
        return t1
    }
</script>

</html>